package com.gitee.l0km.beanfilter.annotations.sql2java;

import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

import com.gitee.l0km.beanfilter.annotations.FieldNameFilter;
import com.gitee.l0km.beanfilter.annotations.FilterMeta;
import com.gitee.l0km.beanfilter.core.Activation;
import com.gitee.l0km.beanfilter.core.CodecPhase;
import com.gitee.l0km.beanfilter.core.CodecScope;
import com.gitee.l0km.common.spring.core.annotation.AliasFor;
import gu.sql2java.BaseBean;

/**
 * 用于sql2java数据库对象的字段过滤器<br>
 * JSON场景时默认排除{@code initialized,modified}字段，
 * 反序列化阶段默认排除 {@code create_time,update_time}字段
 * @author guyadong
 *
 */
@Retention(RUNTIME)
@Target({ METHOD })
@FieldNameFilter(autoCase = true,filterNames = {},
	defaultExcludeNames = {"/JSON:initialized,modified","DE/:create_time,update_time"})
@Repeatable(BaseBeanFieldNameFilters.class)
public @interface BaseBeanFieldNameFilter {
	@AliasFor(annotation = FieldNameFilter.class,attribute = "beanClass")
	Class<? extends BaseBean > beanClass() default BaseBean.class;
	@AliasFor(annotation = FieldNameFilter.class,attribute = "whiteList")
	boolean whiteList() default false;
	@AliasFor(annotation = FieldNameFilter.class,attribute = "filterNames")
	String[] filterNames();
	@AliasFor(annotation = FieldNameFilter.class,attribute = "activeOn")
	Class<? extends Activation>[]  activeOn() default {};
	@AliasFor(annotation = FieldNameFilter.class,attribute = "activeOnClassNames")
	String[]  activeOnClassNames() default {};
	@AliasFor(annotation = FieldNameFilter.class,attribute = "activeAnd")
	boolean  activeAnd() default true;
	/**
	 * @see FilterMeta#phase()
	 */
	@AliasFor(annotation = FilterMeta.class,attribute = "phase")
	CodecPhase phase() default CodecPhase.SERIALIZATION;
	/**
	 * @see FilterMeta#scope()
	 */
	@AliasFor(annotation = FilterMeta.class,attribute = "scope")
	CodecScope scope() default CodecScope.ALL;
}
